using System;
using System.Collections.Generic;
using System.Text;
using DAL;
using Entities;
using Utility;
namespace BUS
{
   public class tbHinhthucthanhtoanBUS
    {
        public static void Insert(tbHinhthucthanhtoan httt)
        {
            tbHinhthucrhanhtoanDAL htttDAL = new tbHinhthucrhanhtoanDAL();
            htttDAL.Insert(httt);
        }
        public static void Update(tbHinhthucthanhtoan httt)
        {
            tbHinhthucrhanhtoanDAL htttDAL = new tbHinhthucrhanhtoanDAL();
            htttDAL.Update(httt);
        }
        public static void Delete(int iD)
        {
            tbHinhthucrhanhtoanDAL htttDAL = new tbHinhthucrhanhtoanDAL();
            htttDAL.Delete(iD);
        }
        public static tbHinhthucthanhtoanColection Get(string where, int pageindex, int pagesize, string orderby, string orderdirection, out int total)
        {
            tbHinhthucrhanhtoanDAL httt = new tbHinhthucrhanhtoanDAL();
            return httt.Get(where, pageindex, pagesize, orderby, orderdirection, out total);
        }
        public static tbHinhthucthanhtoanColection GetAll()
        {
            int total = 0;
            Criteria cri = new Criteria();
            tbHinhthucrhanhtoanDAL htttDAL = new tbHinhthucrhanhtoanDAL();
            return htttDAL.Get(cri.Criter, 0, 0, tbHinhthucthanhtoanColumn.matt.ToString(), OrderDirection.ASC.ToString(), out total);
        }
        public static tbHinhthucthanhtoan GetByID(int iD)
        {
            int total = 0;
            Criteria cri = new Criteria();
            cri.add(Condition.AND, tbHinhthucthanhtoanColumn.matt.ToString(), Condition.EQUAL, iD);
            tbHinhthucrhanhtoanDAL htttDAL = new tbHinhthucrhanhtoanDAL(); ;
            tbHinhthucthanhtoanColection htttColletion = htttDAL.Get(cri.Criter, 0, 0, tbHinhthucthanhtoanColumn.matt.ToString(), OrderDirection.ASC.ToString(), out total);
            if (htttColletion.Count > 0)
                return htttColletion[0];
            return null;
        }
        public static tbHinhthucthanhtoanColection GetLimited(int number)
        {
            int total = 0;
            Criteria cri = new Criteria();
            tbHinhthucrhanhtoanDAL htttDAL = new tbHinhthucrhanhtoanDAL();
            return htttDAL.Get(cri.Criter, 1, number,
            tbHinhthucthanhtoanColumn.matt.ToString(), OrderDirection.DESC.ToString(), out total);
        }
        public static tbHinhthucthanhtoanColection GetPromotion(int number)
        {
            int total = 0;
            Criteria cri = new Criteria();
            tbHinhthucrhanhtoanDAL htttDAL = new tbHinhthucrhanhtoanDAL();
            return htttDAL.Get(cri.Criter, 1, number,
            tbHinhthucthanhtoanColumn.matt.ToString(), OrderDirection.DESC.ToString(), out total);
        }
    }
}
